package com.mrent.util;

import java.util.Date;
import java.util.SortedMap;
import java.util.TreeMap;

public class FormDateLoader {
	
	private static final int YEAR = 5 ;
	
	private static final int MONTH = 12;
	
	private static final int DAYS = 31;
	
	/**
	 * 获取当前年份以前的5年.
	 * 
	 * @return
	 */
	public static SortedMap<String,Object> getSelectYear(){
		SortedMap<String,Object> map = new TreeMap<String,Object>();
		int year = DateUtil.getYear( new Date() );
		for(int i = year - YEAR; i<= year;i++){
			map.put( String.valueOf(i) ,i);
		}
		return map;
	}
	
	/**
	 * 获取一年的12个月份.
	 * @return
	 */
	public static SortedMap<String,Object> getSelectMonth(){
		SortedMap<String,Object> map = new TreeMap<String,Object>();
		for(int i = 1;i <= MONTH ; i++){
			String month = i<10?("0"+i):(""+i);
			map.put(month, month);
		}
		return map;
	}
	
	/**
	 * 获取天数，最大31天.
	 * 
	 * @return
	 */
	public static SortedMap<String,Object> getSelectDay(){
		SortedMap<String,Object> map = new TreeMap<String,Object>();
		for(int i = 1;i <= DAYS ; i++){
			String day = i<10?("0"+i):(""+i);
			map.put(day, day);
		}
		return map;
	}

}
